#
# @lc app=leetcode.cn id=746 lang=python
#
# [746] 使用最小花费爬楼梯
#

# @lc code=start
class Solution(object):
    def minCostClimbingStairs(self, cost):
        """
        :type cost: List[int]
        :rtype: int
        """
        # 从当前层爬楼需要消耗的体力
        dp = [0] * 2
        dp[0] = cost[0]
        dp[1] = cost[1]
        for i in range(2, len(cost)):
            temp = min(dp[0], dp[1])+cost[i]
            dp[0] = dp[1]
            dp[1] = temp
        return min(dp[0], dp[1])
        
        
# @lc code=end

